package org.movee.spring.data.hugegraph.annotation;


import org.movee.spring.data.hugegraph.schema.IndexType;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * The Index annotation is used in schema generation. Note that it is not necessary to specify an index
 * for a primary key, as the primary key index will be created automatically, however, the Index annotation
 * may be used to specify the ordering of the columns in the index for the primary key.
 *
 * @since
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@Inherited
@Documented
public @interface Index {
    /**
     * (Optional) The name of the index.  Defaults to a provider-generated value.
     *
     * @return The index name
     */
    String name() default "";

    /**
     * (Optional) Whether the index is unique.  Default is false.
     *
     * @return Is the index unique?
     */
    boolean unique() default false;

    /**
     * (Optional) The type of the index.  valid values: secondary, range, search, shard.
     *
     * @return The index type value
     */
    IndexType type() default IndexType.SECONDARY;

    String[] fields() default {};

}
